/*
 * Copyright (C) 2009 2DAI
 *
 * Este programa es Software Libre; usted puede redistribuirlo
 * y/o modificarlo bajo los términos de la "GNU General Public
 * License" como lo publica la "FSF Free Software Foundation",
 * o (a su elección) de cualquier versión posterior.
 *
 * Este programa es distribuido con la esperanza de que le será
 * útil, pero SIN NINGUNA GARANTIA; incluso sin la garantía
 * implícita por el MERCADEO o EJERCICIO DE ALGUN PROPOSITO en
 * particular. Vea la "GNU General Public License" para más
 * detalles.
 *
 * Usted debe haber recibido una copia de la "GNU General Public
 * License" junto con este programa, si no, escriba a la "FSF
 * Free Software Foundation, Inc.", 59 Temple Place - Suite 330,
 * Boston, MA  02111-1307, USA.
 */
package gui;

import on.ClubRepresentatives;

/**
 *
 * Author: Francisco Pardo
 */
public class MaintClubRepresentatives extends logic.ContentiPanel<ClubRepresentatives> {
    private int id;
    private String nombre_club;
    /** Creates new form Players */
    public MaintClubRepresentatives() {
        initComponents();
    }

    /**Metodo en el que paso el contenido de los campos al
     * objeto CLUBREPRESENTATIVES*/
    public void setContenido(ClubRepresentatives cr){
        this.nombre_club = cr.getClub();
        this.id=cr.getId_RepresentantesClub();
        this.JFTFnumLicencia.setText(String.valueOf(cr.getNum_licencia()));
        this.JTFnombre.setText(cr.getNombre());
        this.JTFapellidos.setText(cr.getApellidos());
        this.JTFdni.setText(String.valueOf(cr.getDni()));
        this.JFTFcp.setText(String.valueOf(cr.getCodigoPostal()));
        this.JTFdireccion.setText(cr.getDireccion());
        this.JTFpoblacion.setText(cr.getPoblacion());
        this.JTFprovincia.setText(cr.getProvincia());
        this.JFTFtelefono.setText(String.valueOf(cr.getTelefono()));
        this.JFTFcorreo.setText(cr.getEMail());
        this.JCBclase.setSelectedItem(cr.getClase());
        this.JTFClub.setText(cr.getClub());
    }

    /**Metodo que muestra el contenido y lo comprime en el
     * objeto CLUBREPRESENTATIVES*/
    public ClubRepresentatives getContenido(){
        ClubRepresentatives cr=new ClubRepresentatives();
        cr.setId_RepresentantesClub(id);
        cr.setNum_licencia(Integer.parseInt(this.JFTFnumLicencia.getText()));
        cr.setNombre(this.JTFnombre.getText());
        cr.setApellidos(this.JTFapellidos.getText());
        cr.setDni(Integer.parseInt(this.JTFdni.getText()));
        cr.setCodigoPostal(Integer.parseInt(this.JFTFcp.getText()));
        cr.setDireccion(this.JTFdireccion.getText());
        cr.setPoblacion(this.JTFpoblacion.getText());
        cr.setProvincia(this.JTFprovincia.getText());
        cr.setTelefono(Integer.parseInt(this.JFTFtelefono.getText()));
        cr.setEMail(this.JFTFcorreo.getText());
        cr.setClase(this.JCBclase.getSelectedItem().toString());
        cr.setId_club(Integer.parseInt(this.JTFClub.getText()));
        this.nombre_club=this.JTFClub.getText();
        cr.setClub(nombre_club);
        return cr;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        JTBdatos = new javax.swing.JTabbedPane();
        JPdatospersonales = new javax.swing.JPanel();
        JLnombre = new javax.swing.JLabel();
        JTFnombre = new javax.swing.JTextField();
        JLdni = new javax.swing.JLabel();
        JLdireccion = new javax.swing.JLabel();
        JLcp = new javax.swing.JLabel();
        JLprovincia = new javax.swing.JLabel();
        JLpoblacion2 = new javax.swing.JLabel();
        JTFdni = new javax.swing.JTextField();
        JTFdireccion = new javax.swing.JTextField();
        JFTFcp = new javax.swing.JFormattedTextField();
        JTFprovincia = new javax.swing.JTextField();
        JFTFtelefono = new javax.swing.JFormattedTextField();
        JLApellidos = new javax.swing.JLabel();
        JTFapellidos = new javax.swing.JTextField();
        JLpoblacion = new javax.swing.JLabel();
        JTFpoblacion = new javax.swing.JTextField();
        JLpoblacion1 = new javax.swing.JLabel();
        JFTFcorreo = new javax.swing.JFormattedTextField();
        JPdatosJugador = new javax.swing.JPanel();
        JLnumLicencia = new javax.swing.JLabel();
        JCBclase = new javax.swing.JComboBox();
        JLclase = new javax.swing.JLabel();
        JFTFnumLicencia = new javax.swing.JFormattedTextField();
        JLClub = new javax.swing.JLabel();
        JTFClub = new javax.swing.JTextField();

        JLnombre.setText("Nombre");

        JLdni.setText("DNI/CIF/Pas");
        JLdni.setPreferredSize(new java.awt.Dimension(100, 14));

        JLdireccion.setText("Dirección");

        JLcp.setText("CP");

        JLprovincia.setText("Provincia");

        JLpoblacion2.setText("Teléfono");

        JLApellidos.setText("Apellidos");

        JLpoblacion.setText("Población");

        JLpoblacion1.setText("Correo");

        javax.swing.GroupLayout JPdatospersonalesLayout = new javax.swing.GroupLayout(JPdatospersonales);
        JPdatospersonales.setLayout(JPdatospersonalesLayout);
        JPdatospersonalesLayout.setHorizontalGroup(
            JPdatospersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPdatospersonalesLayout.createSequentialGroup()
                .addGap(39, 39, 39)
                .addGroup(JPdatospersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(JPdatospersonalesLayout.createSequentialGroup()
                        .addGroup(JPdatospersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(JLdni, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(JLnombre)
                            .addComponent(JLdireccion))
                        .addGap(18, 18, 18))
                    .addGroup(JPdatospersonalesLayout.createSequentialGroup()
                        .addComponent(JLcp)
                        .addGap(18, 18, 18)))
                .addGroup(JPdatospersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(JPdatospersonalesLayout.createSequentialGroup()
                        .addComponent(JFTFcp, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(JPdatospersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(JPdatospersonalesLayout.createSequentialGroup()
                            .addComponent(JTFdireccion, javax.swing.GroupLayout.PREFERRED_SIZE, 342, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap())
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, JPdatospersonalesLayout.createSequentialGroup()
                            .addGroup(JPdatospersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(JTFdni, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE)
                                .addComponent(JTFnombre, javax.swing.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE))
                            .addGap(45, 45, 45)
                            .addComponent(JLApellidos)
                            .addGap(18, 18, 18)
                            .addComponent(JTFapellidos, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(13, 13, 13)))))
            .addGroup(JPdatospersonalesLayout.createSequentialGroup()
                .addGap(56, 56, 56)
                .addGroup(JPdatospersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(JLprovincia)
                    .addComponent(JLpoblacion2))
                .addGap(18, 18, 18)
                .addGroup(JPdatospersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, JPdatospersonalesLayout.createSequentialGroup()
                        .addComponent(JFTFtelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 62, Short.MAX_VALUE)
                        .addComponent(JLpoblacion1)
                        .addGap(18, 18, 18)
                        .addComponent(JFTFcorreo, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, JPdatospersonalesLayout.createSequentialGroup()
                        .addComponent(JTFprovincia, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 45, Short.MAX_VALUE)
                        .addComponent(JLpoblacion)
                        .addGap(18, 18, 18)
                        .addComponent(JTFpoblacion, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        JPdatospersonalesLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {JFTFcorreo, JFTFtelefono, JTFpoblacion, JTFprovincia});

        JPdatospersonalesLayout.setVerticalGroup(
            JPdatospersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPdatospersonalesLayout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addGroup(JPdatospersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JLnombre)
                    .addComponent(JTFnombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JLApellidos)
                    .addComponent(JTFapellidos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(JPdatospersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JLdni, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JTFdni, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(12, 12, 12)
                .addGroup(JPdatospersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JTFdireccion, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JLdireccion))
                .addGap(12, 12, 12)
                .addGroup(JPdatospersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JFTFcp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JLcp))
                .addGap(12, 12, 12)
                .addGroup(JPdatospersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JTFpoblacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JLpoblacion)
                    .addComponent(JLprovincia)
                    .addComponent(JTFprovincia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(14, 14, 14)
                .addGroup(JPdatospersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JFTFtelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JFTFcorreo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JLpoblacion1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JLpoblacion2, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(68, Short.MAX_VALUE))
        );

        JTBdatos.addTab("Datos Personales", JPdatospersonales);

        JLnumLicencia.setText("Nº Licencia");

        JCBclase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ENT", "DEL", "DEC", "DIR", "AUX" }));

        JLclase.setText("Clase");

        JLClub.setText("Id / Club");

        javax.swing.GroupLayout JPdatosJugadorLayout = new javax.swing.GroupLayout(JPdatosJugador);
        JPdatosJugador.setLayout(JPdatosJugadorLayout);
        JPdatosJugadorLayout.setHorizontalGroup(
            JPdatosJugadorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPdatosJugadorLayout.createSequentialGroup()
                .addGap(55, 55, 55)
                .addGroup(JPdatosJugadorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(JLclase)
                    .addComponent(JLnumLicencia)
                    .addComponent(JLClub))
                .addGap(18, 18, 18)
                .addGroup(JPdatosJugadorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(JTFClub, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE)
                    .addComponent(JCBclase, 0, 128, Short.MAX_VALUE)
                    .addComponent(JFTFnumLicencia, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE))
                .addGap(301, 301, 301))
        );
        JPdatosJugadorLayout.setVerticalGroup(
            JPdatosJugadorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPdatosJugadorLayout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(JPdatosJugadorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JFTFnumLicencia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JLnumLicencia))
                .addGap(18, 18, 18)
                .addGroup(JPdatosJugadorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JCBclase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JLclase))
                .addGap(28, 28, 28)
                .addGroup(JPdatosJugadorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JLClub)
                    .addComponent(JTFClub, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(175, Short.MAX_VALUE))
        );

        JTBdatos.addTab("Datos Representante", JPdatosJugador);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(JTBdatos, javax.swing.GroupLayout.DEFAULT_SIZE, 564, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(JTBdatos, javax.swing.GroupLayout.DEFAULT_SIZE, 354, Short.MAX_VALUE)
                .addGap(20, 20, 20))
        );

        JTBdatos.getAccessibleContext().setAccessibleName("Datos");
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox JCBclase;
    private javax.swing.JFormattedTextField JFTFcorreo;
    private javax.swing.JFormattedTextField JFTFcp;
    private javax.swing.JFormattedTextField JFTFnumLicencia;
    private javax.swing.JFormattedTextField JFTFtelefono;
    private javax.swing.JLabel JLApellidos;
    private javax.swing.JLabel JLClub;
    private javax.swing.JLabel JLclase;
    private javax.swing.JLabel JLcp;
    private javax.swing.JLabel JLdireccion;
    private javax.swing.JLabel JLdni;
    private javax.swing.JLabel JLnombre;
    private javax.swing.JLabel JLnumLicencia;
    private javax.swing.JLabel JLpoblacion;
    private javax.swing.JLabel JLpoblacion1;
    private javax.swing.JLabel JLpoblacion2;
    private javax.swing.JLabel JLprovincia;
    private javax.swing.JPanel JPdatosJugador;
    private javax.swing.JPanel JPdatospersonales;
    private javax.swing.JTabbedPane JTBdatos;
    private javax.swing.JTextField JTFClub;
    private javax.swing.JTextField JTFapellidos;
    private javax.swing.JTextField JTFdireccion;
    private javax.swing.JTextField JTFdni;
    private javax.swing.JTextField JTFnombre;
    private javax.swing.JTextField JTFpoblacion;
    private javax.swing.JTextField JTFprovincia;
    // End of variables declaration//GEN-END:variables

    @Override
    public void enableTextFields(boolean boo) {
        JFTFcorreo.setEnabled(boo);
        JFTFcp.setEnabled(boo);
        JFTFnumLicencia.setEnabled(boo);
        JFTFtelefono.setEnabled(boo);
        JTFapellidos.setEnabled(boo);
        JTFdireccion.setEnabled(boo);
        JTFdni.setEnabled(boo);
        JTFnombre.setEnabled(boo);
        JTFpoblacion.setEnabled(boo);
        JTFprovincia.setEnabled(boo);
        JCBclase.setEnabled(boo);
        JTFClub.setEnabled(boo);
    }

    @Override
    public void clearTextFields() {
        this.JFTFnumLicencia.setText("");
        this.JTFnombre.setText("");
        this.JTFapellidos.setText("");
        this.JTFdni.setText("");
        this.JFTFcp.setText("");
        this.JTFdireccion.setText("");
        this.JTFpoblacion.setText("");
        this.JTFprovincia.setText("");
        this.JFTFtelefono.setText("");
        this.JFTFcorreo.setText("");
        this.JCBclase.setSelectedItem("");
        this.JTFClub.setText("");
    }
}
